package com.domcer.ultra.menu.common.constants;

import com.domcer.ultra.menu.engine.require.CoinsRequire;
import com.domcer.ultra.menu.engine.require.PermissionRequire;
import com.domcer.ultra.menu.engine.require.PlayerPointsRequire;
import com.domcer.ultra.menu.engine.require.Require;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Author Sensen
 * @Date 2025/1/31 17:44
 */
@Getter
@AllArgsConstructor
public enum RequireTypeEnum {
    PERMISSION(new PermissionRequire()),
    PLAYER_POINTS(new PlayerPointsRequire()),
    COINS(new CoinsRequire())
    ;

    private final Require require;

    public static RequireTypeEnum getByName(String name) {
        return Arrays.stream(values())
                .filter(requireTypeEnum -> requireTypeEnum.name().equalsIgnoreCase(name))
                .findFirst()
                .orElse(PERMISSION);
    }
}
